<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Специальность</title>
    </h:head>
    <h:body>
        <h:form id="editSpeciality">
            <h:outputLabel id ="facLabel" value="Факультет: "/>
            <h:selectOneMenu id="faculty" title="Выберите факультет из списка" value="#{editSpecialityBean.selectedFaculty}" >
                <f:validateRequired/>
                <f:selectItems id="facultyList" value="#{editSpecialityBean.selectFaculties}"/>
                <f:ajax event="change" render="department"/>
            </h:selectOneMenu><br/>
            <h:outputLabel id ="depLabel" value="Кафедра "/>
            <h:selectOneMenu id="department" title="Выберите кафедру из списка" value="#{editSpecialityBean.selectedDepartment}">
                <f:validateRequired/>
                <f:selectItems id="departmentList" value="#{editSpecialityBean.selectDepartments}"/>
            </h:selectOneMenu><br/>
            <h:outputLabel id ="refLabel" value="Код Специальности: "/>
            <h:inputText id="refNumber" value="#{editSpecialityBean.referenceNumber}">
                <f:validateRequired/>
            </h:inputText><br/>
            <h:outputLabel id ="specLabel" value="Специальность: "/>
            <h:inputText id="specName" value="#{editSpecialityBean.title}">
                <f:validateRequired/>
            </h:inputText><br/>
            <h:outputLabel id ="shortNameLabel" value="Сокращение: "/>
            <h:inputText id="shortName" value="#{editSpecialityBean.shortName}">
                <f:validateRequired />
            </h:inputText><br/>
            <h:message for="specName shortName refNumber" style="color:red" />
            <h:commandButton id="Save" value="Сохранить" actionListener="#{editSpecialityBean.update}" action="index.xhtml"/>
            <h:commandButton id="Cancel" value="Отмена" action="index.xhtml" immediate="true"/>
        </h:form>
    </h:body>
</html>

